import axios from 'axios';
import Vue from 'vue';
import VueLocalStorage from 'vue-ls';

Vue.use(VueLocalStorage, {
	namespace: 'web_'
});

let util = {

};

util.title = function(title) {
    title = title ? title + ' - 前端' : 'web';
    window.document.title = title;
};

const ajaxUrl = process.env.NODE_ENV === 'development' ?
    'http://web.test/api/admin' :
    'https://web.test';

util.ajax = axios.create({
    baseURL: ajaxUrl,
    timeout: 30000
});

export default util;